<!DOCTYPE HTML>
<html>
<%@ include file="jsp/common.jsp" %>
<%@ page  language="java" import="java.util.*" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<head>
<link rel="shortcut icon" href="img/xuejiadmin.jpg"> 
<link href="css/mainbody_style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="css/base_button.css"/>
<title>学籍管理系统</title>
</head>
<body style="background-image:url(img/bg_06.jpg);background-repeat:no-repeat;background-size:100% auto;">
	<div style="margin-left:40%;margin-top:200px;">
		<form id="loginForm" method="Post" >
			<table>
				<tr>
					<td align="right">账号：</td>
					<td align="left" colspan="2" >
						<input type="text" name="username" id="username" style="width:150px;" value="wangpan001"/>
					</td>
				</tr>
				<tr>
					<td align="right">密码：</td>
					<td align="left" colspan="2" >
						<input type="password" name="password" id="password" style="width:150px;" value="wp123"/>
					</td>
				</tr>
				<tr>
					<td colspan="3" >&nbsp;</td>
				</tr>
				<tr>
					<td colspan="2">
						<input type="button" class="button_sub01" value="登陆"  onclick="login();"/>
					</td>
					<td style="text-align:center;">
						<input type="button" class="button_sub01" value="注册" onclick="regUser();"/>
					</td>
				</tr>
			</table>
		</form>
	</div>

<script type="text/javascript">
/*********注册页面**********/
function regUser(){
	$("#loginForm").attr("action","register.do");
	$("#loginForm").submit();
}

/***********登陆页面********/
 function login(){
	if(validParam()){
		$("#loginForm").attr("action","login.do");
		$("#loginForm").submit();
	}
	return;
}

/******检验登陆用户和密码******/
	function validParam(){
		var username = $("#username").val();
		var password = $("#password").val();
		var reg1 = /^[a-zA-Z](\w){3,19}$/;		//用户名是以字母开头，6-20位字母、数字、下划线
		var reg2 = /^[a-zA-z0-9]{5,12}$/;		//密码为8-12位字母、数字
		
		if(username && password){
			if(!reg1.test(username)){
				alert("用户名是以字母开头，6-20位字母、数字、下划线");
				return;
			}
			if(!reg2.test(password)){
				alert("用户密码不正确");
				return;
			}
		}else{
			alert("用户名和密码不能为空")
			return;
		}
		return true;
	}
 
</script>
</body>
</html>